﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuantitativeInvestment.Bean;

namespace QuantitativeInvestment.Factor
{
    class MarketValueFactor:Factor
    {
        public MarketValueFactor()
        {
            this.name = "市值";
            Parameter p = new Parameter("类型", "流通市值");
            p.type = "enum";
            p.enumList.Add("流通市值");
            p.enumList.Add("总市值");
            p.enumList.Add("行业相对市值");
            this.paraList.Add(p.name, p);
        }

        public override void addFactorValue(Stock stock)
        {
            string type=this.paraList["类型"].value.ToString();
            if (!stock.factors.ContainsKey(this.name+"-"+type))
            {
              double[] marketValues= this.dataModel.getStockMarketValueInCurrencyList(stock.startDate,stock.endDate,stock.code);
              stock.factors.Add(this.name + "-" + type, marketValues);
            }
        }
    }
}
